function fig7_5

%  solve IVP using MATLAB routines
%         y' = f(t,y)  with   y(0) = y0
%  where y = (y1, y2, y3 , ..., yn) is an n-vector

clf
% get(gcf)
set(gcf,'Position', [25 1115 658 230])
subaxis(1,1,1,1,'MT',0.1,'MB',0.18,'MR',-0.02,'ML',0.045,'P',0.04)

hold on

for i=1:2
    % time interval
    
    if i==1  % comes close to (0,0)
        tmax=250;
        y10=0.01; y20=0;
        y0=[y10 y20];
    else   % comes close to (0,0)
        tmax=2050;
        y10=0.001; y20=0;
        y0=[y10 y20];
    end

    %  calculate solution using a MATLAB routine
    opts = odeset('RelTol',1e-12,'AbsTol',1e-12);
    [t,y] = ode45(@rhs,[0 tmax],y0,opts);
    %[t,y] = ode23s(@rhs,[0 tmax],y0);
    if i==1
        plot(t,y(:,1),'b','LineWidth',1)
        %plot([2/y10 2/y10],[0 1000],'--b','LineWidth',1.1)
    else
        plot(t,y(:,1),'r','LineWidth',1)
        %plot([2/y10 2/y10],[0 1000],'--r','LineWidth',1.1)
    end
    %plot(y(1,1),y(1,2),'.b','Markersize',20)
end

axis([0 tmax -0.01 1])
% commands to label each axes
grid on
box on
ax = gca;
ax.XAxis.TickLabelInterpreter = 'latex';
ax.YAxis.TickLabelInterpreter = 'latex';
set(gca,'FontSize',13)

xlabel('$t$\,-\,axis','Interpreter','latex','FontSize',14)
ylabel('$y(t)$','Interpreter','latex','FontSize',14)
legend({'$\, \delta=0.01 $','$\, \delta = 0.001 $'},'Location','North','Interpreter','Latex','FontSize',13,'AutoUpdate','off')
plot([2/0.01 2/0.01],[0 1000],'--b','LineWidth',1.1)
plot([2/0.001 2/0.001],[0 1000],'--r','LineWidth',1.1)
hold off

%exportgraphics(gca,'/Users/mark/Desktop/stable.pdf')


%  define f(t,y)
function dy=rhs(t,y)
dy=zeros(2,1);
dy(1) = y(2);
dy(2) =-2*y(2) + y(1)^2;













